<div class="sidebar_box"><span class="bottom"></span>
            	<h3>Categories</h3>   
                <div class="content"> 
                	<div id="accordion">
						<h4>Brand</h4>
						<div>
							<ul class="accordion_list">
							<?php
								$query = mysql_query("SELECT * FROM tblbrand")or die(mysql_error());
								
								$display = "";
								while($row = mysql_fetch_array($query)){
										$brandid = $row['id'];
										$brandname = $row['brand'];
											$display .= '<a href="cars.php?brand='.$brandname.'" class="cat " name="'.$brandname.'"><li><font style="color:white;">' .$brandname .'</font></li></a>';
											
										$query2 = mysql_query("SELECT * FROM tblmodel")or die(mysql_error());			
										while($rows = mysql_fetch_array($query2)){
											
											if($brandid == $rows['brandId']){
											
											$display .= '&nbsp&nbsp<a href="../cars.php?model='.$rows['modelname'].'" name="'.$rows['modelname'].'"><font style="color:red;">'.$rows['modelname'].'</font></a></br>';	
											}
									}
									
								}
								echo $display;
							?>
							</ul>
						</div>
						<h4>Accessories</h4>
						<div>
							<?php
								$query = mysql_query("SELECT * FROM tblparts")or die(mysql_error());
								while($row = mysql_fetch_array($query)){
									echo '<a href="#" class="cat " name="'.$row['parts'].'"><li><font style="color:white;">'.$row['parts'].'</font></li></a>';								
								}
							?>
						</div>
						
						
					</div>
                </div>
            </div>